﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.ClientServices;
using System.Web.UI.HtmlControls;
public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string _strCXLive = CE.Configuration.MyConfigurationManager.GetAppSettingValue("IsCXLive");
        if (_strCXLive == "0")
        {
            if (Session[CE.Global.General.Guest] == null)
            {
                Response.Redirect("~/Default2.aspx");
            }
        }

        #region Page Script Reference
        /*
        //<script type="text/javascript" src="js/plugins/forms/jquery.cleditor.js"></script>
        HyperLink _hplJS = new HyperLink();
        _hplJS.NavigateUrl = "~/css/main.css";

        HtmlLink _cssLink = new HtmlLink();
        _cssLink.Attributes.Add("rel", "stylesheet");
        _cssLink.Attributes.Add("type", "text/css");
        
        _cssLink.Href = "~/css/main.css";
        head.Controls.Add(_cssLink);

        //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyMainCss", "<link rel='stylesheet' type='text/css' href='" + _hplJS.ResolveClientUrl(_hplJS.NavigateUrl) + "'/>");

        //_hplJS.NavigateUrl = "~/css/animate.css";
        //head.Controls.Add(_hplJS);
        _cssLink.Href = "~/css/animate.css";
        head.Controls.Add(_cssLink);
        //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyAnimateCss", "<link rel='stylesheet' type='text/css' href='" + _hplJS.ResolveClientUrl(_hplJS.NavigateUrl) + "'/>");

        //_hplJS.NavigateUrl = "~/css/showcase.css";
        //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyShowCaseCss", "<link rel='stylesheet' type='text/css' href='" + _hplJS.ResolveClientUrl(_hplJS.NavigateUrl) + "'/>");
        _cssLink.Href = "~/css/showcase.css";
        head.Controls.Add(_cssLink);

        _hplJS.NavigateUrl = "~/images/icon/favicon.ico";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyFaviconIcon", "<link rel='shortcut icon' href='" + _hplJS.ResolveClientUrl(_hplJS.NavigateUrl) + "'/>");

        _hplJS.NavigateUrl = "~/images/public/tds.jpg";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyPublicTDSJpg", "<link rel='image_src' href='" + _hplJS.ResolveClientUrl(_hplJS.NavigateUrl) + "'/>");

        _hplJS.NavigateUrl = "~/scripts/jquery.js";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyJqueryJS", "<script type='text/javascript' src='" + _hplJS.ResolveClientUrl(_hplJS.NavigateUrl) + "'></script>");

        _hplJS.NavigateUrl = "http://www.josiah.com.sg/scripts/jquery.js";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyJqueryJOSCOMSG", "<script type='text/javascript' src='" + _hplJS.ResolveClientUrl(_hplJS.NavigateUrl) + "'></script>");

        _hplJS.NavigateUrl = "~/scripts/animate.js";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScriptAnimate", "<script type='text/javascript' src='" + _hplJS.ResolveClientUrl(_hplJS.NavigateUrl) + "'></script>");

        _hplJS.NavigateUrl = "~/scripts/facebox.js";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScriptFacebox", "<script type='text/javascript' src='" + _hplJS.ResolveClientUrl(_hplJS.NavigateUrl) + "'></script>");

        _hplJS.NavigateUrl = "~/scripts/tracker.js";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScriptTracker", "<script type='text/javascript' src='" + _hplJS.ResolveClientUrl(_hplJS.NavigateUrl) + "'></script>");
         * */

        //Checking Mobile Browser
        HyperLink _hplJS = new HyperLink();

        if (MobileDeviceUtil.isMobileBrowser())
        {
            _hplJS.NavigateUrl = "~/scripts/navigate-mob.js";
        }
        else
        {
            _hplJS.NavigateUrl = "~/scripts/navigate.js";
        }

        //HtmlGenericControl _hgc = new HtmlGenericControl("script");
        //_hgc.Attributes.Add("type", "text/javascript");
        //_hgc.Attributes.Add("src", _hplJS.ResolveClientUrl(_hplJS.NavigateUrl));
        //headBottom.Controls.Add(_hgc);
        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScriptNavigate", "<script type='text/javascript' src='" + _hplJS.ResolveClientUrl(_hplJS.NavigateUrl) + "'></script>");
        //END Checking Mobile Browser
        #endregion

        string _pageUrl = Request.Url.ToString().ToLower();

        if (_pageUrl.Contains("/about/") ||
            _pageUrl.Contains("/careers/") ||
            _pageUrl.Contains("/casestudy/") ||
            _pageUrl.Contains("/contact/") ||
            _pageUrl.Contains("/difference/") ||
            _pageUrl.Contains("/news/") ||
            _pageUrl.Contains("/solutions/"))
        {
            divTagLine.Visible = false;
            divFooter.Visible = true;

            divFooterHome.Visible = false;
        }
        else
        {
            //divTagLine.Visible = true;
            //divFooterHome.Visible = true;

            //divFooter.Visible = false;

            /*****Home page show footer nagivation*****/
            divTagLine.Visible = false;
            divFooter.Visible = true;

            divFooterHome.Visible = false;
        }
    }

    
}
